package com.flymobi.service;

import java.util.List;

import com.flymobi.fw.modules.CommonService;
import com.flymobi.po.PageBlockContent;
import com.flymobi.util.QL;

public class PageBlockContentService extends CommonService {

	public List<PageBlockContent> list(Long pageBlockId,int startRow, int pagePerSize) {
		return dao.find(PageBlockContent.class, QL.HQL.PageBlockContent.LIST_CONTENT,
				new Object[] {pageBlockId}, startRow, pagePerSize);
	}
	
	public PageBlockContent getTop(Long pageBlockId) {
		return dao.findSingle(PageBlockContent.class, QL.HQL.PageBlockContent.getTop,
				new Object[] {pageBlockId});
	}
	
	public List<PageBlockContent> list(Long pageBlockId,Long pindaoId,int startRow, int pagePerSize) {
		return dao.find(PageBlockContent.class, QL.HQL.PageBlockContent.LIST_CONTENT_PINDAO,
				new Object[] {pageBlockId,pindaoId,pindaoId}, startRow, pagePerSize);
	}
	
	public List<PageBlockContent> list(Long contId,String type,int startRow, int pagePerSize) {
		return dao.find(PageBlockContent.class, QL.HQL.PageBlockContent.LIST_BLOCK,
				new Object[] {contId,type}, startRow, pagePerSize);
	}
	
	public Long getCount(Long pageBlockId) {
		return dao.getCount(QL.HQL.PageBlockContent.GET_COUNT, new Object[] {pageBlockId});
	}


	public void save(PageBlockContent PageBlockContent) {
		dao.save(PageBlockContent);
	}

	public PageBlockContent load(String id) {
		return dao.load(PageBlockContent.class, new Long(id));
	}

	public PageBlockContent get(String id) {
		return dao.get(PageBlockContent.class, new Long(id));
	}

	public void delete(String id) {
		dao.delete(this.get(id));
	}
	
	public void deleteByContId(Long contId,String type) {
		dao.executeByHQL(QL.HQL.PageBlockContent.DELETE_BY_contID, new Object[]{contId,type});
	}
}
